package org.sundatagroup.aurora.show.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.sundatagroup.aurora.show.controller.DisplayStatusEndpoint;

/**
 * 向系统注册所有 WebSocket 终端 (展示区部分),
 * 以及前端进行访问时配置的路径.
 * @author Zdream
 * @date 2018-05-17
 * @since 0.2.0
 */
@Configuration
@EnableWebSocket
public class ShowEndPointRegister implements WebSocketConfigurer {
	
	@Autowired
	DisplayStatusEndpoint show;

	@Override
	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		// 播放页
		registry.addHandler(show, "/aurora/screen/{sid}");
		// 等待页
		registry.addHandler(show, "/aurora/wait");
	}

}
